package com.ztx.web.controller.sys;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ztx.model.BranchVO;
import com.ztx.model.QkType;
import com.ztx.service.base.IBaseService;

/**
 * 
 * 用于获取一些公共参数，例如资源类型
 *
 */
@Controller
@RequestMapping("commonController")
public class CommonController {

	private static Logger log = LoggerFactory.getLogger(CommonController.class);
	@Resource
	private IBaseService baseService;

	/**
	 * 获取分店列表
	 * 
	 * @return
	 */
	@RequestMapping(value = "branchList", method = RequestMethod.POST)
	@ResponseBody
	public List<BranchVO> getBranch() {
		List<BranchVO> list = null;
		try {
			list = baseService.selectList(BranchVO.class.getName()
					+ ".getAllBranch");
		} catch (Exception e) {
			log.error("查询分店列表错误", e);
		}
		return list;
	}
	/**
	 * 获取欠款类型
	 * @return
	 */
	@RequestMapping(value = "qktypeList", method = RequestMethod.POST)
	@ResponseBody
	public List<QkType> getQktypeList() {
		List<QkType> list = null;
		try {
			list = baseService.selectList(QkType.class.getName()
					+ ".getAllQkType");
		} catch (Exception e) {
			log.error("查询分店列表错误", e);
		}
		return list;
	}
}
